
organization in ThisBuild := "celetium"

// the Scala version that will be used for cross-compiled libraries
scalaVersion in ThisBuild := "2.11.8"

ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }

val playJsonDerivedCodecs = "org.julienrf" %% "play-json-derived-codecs" % "3.3"
val macwire = "com.softwaremill.macwire" %% "macros" % "2.2.5" % "provided"
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.0-SNAP1" % "test"
val logBack = "ch.qos.logback" % "logback-classic" % "1.1.3"

enablePlugins(JavaAppPackaging)

def project(id: String) = Project(id, base = file(id))
  .settings(javacOptions in compile ++= Seq("-encoding", "UTF-8", "-source", "1.8", "-target", "1.8", "-Xlint:unchecked", "-Xlint:deprecation"))
  .settings(libraryDependencies ++= Seq(scalaTest)
)

lazy val utils = project("biGATE-utils")
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslApi,
      lagomScaladslServer % Optional,
      playJsonDerivedCodecs,
      "com.typesafe.akka" %% "akka-http-jackson" % "10.0.0",
      "com.typesafe.akka" %% "akka-http-spray-json" % "10.0.0"
    )
  )

lazy val pcks = project("biGATE-pcks")
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      logBack,
      "org.scala-lang" % "scalap" % "2.11.8"
    )
  ).dependsOn(utils)

lazy val third = project("biGATE-third")
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslApi,
      playJsonDerivedCodecs
    )
  ).dependsOn(utils)

lazy val third1Impl = project("biGATE-third-impl1")
  .settings(commonSettings: _*)
  .enablePlugins(LagomScala)
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  )
  .settings(lagomForkedTestSettings: _*)
  .dependsOn(third, utils)

lazy val third2Impl = project("biGATE-third-impl2")
  .settings(commonSettings: _*)
  .enablePlugins(LagomScala)
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  )
  .settings(lagomForkedTestSettings: _*)
  .dependsOn(third, utils)

lazy val pay = project("biGATE-pay")
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslApi,
      playJsonDerivedCodecs
    )
  ).dependsOn(utils)

lazy val payImpl = project("biGATE-pay-impl")
  .settings(commonSettings: _*)
  .enablePlugins(LagomScala)
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslPersistenceCassandra,
      lagomScaladslServer,
      lagomScaladslTestKit,
      macwire
    )
  )
  .settings(lagomForkedTestSettings: _*)
  .dependsOn(third, utils, pay)

lazy val sample = project("biGATE-sample")
  .settings(
    version := "0.1",
    libraryDependencies ++= Seq(
      lagomScaladslApi,
      logBack,
      "org.squbs" %% "squbs-unicomplex" % "0.9.0-SNAPSHOT",
      "org.squbs" %% "squbs-ext" % "0.9.0-SNAPSHOT",
      "org.squbs" %% "squbs-httpclient" % "0.9.0-SNAPSHOT",
      "org.squbs" %% "squbs-pattern" % "0.9.0-SNAPSHOT",
      "org.squbs" %% "squbs-zkcluster" % "0.9.0-SNAPSHOT",
      "com.typesafe.scala-logging" %% "scala-logging" % "3.1.0",
      "com.typesafe.akka" %% "akka-agent" % "2.4.10",
      "com.typesafe.akka" %% "akka-http" % "10.0.0"
    ),
    unmanagedJars in Compile ++= Seq(
      Attributed.blank[File](file(baseDirectory.value + "/../lib/bottlecube_2.11-0.9.0-SNAPSHOT.jar")),
      Attributed.blank[File](file(baseDirectory.value + "/../lib/bottlemsgs_2.11-0.9.0-SNAPSHOT.jar"))
    )
  ).dependsOn(utils, pcks)

def commonSettings: Seq[Setting[_]] = Seq(
)

lagomCassandraCleanOnStart in ThisBuild := false
lagomKafkaEnabled in ThisBuild := false
lagomCassandraEnabled in ThisBuild := false